﻿#ifndef ZMQRESPONDER_H
#define ZMQRESPONDER_H
#include <QObject>
#include <QMutex>
#include <QQueue>
#include <QWaitCondition>
#include <zmq.h>
#include "baseresponder.h"

class ZmqResponder : public BaseResponder
{
    Q_OBJECT
public:
    Q_INVOKABLE explicit ZmqResponder(QObject *parent = nullptr);

    // BaseCommunicationZZZ interface
public:
    virtual bool connectToHost() override;
    virtual bool isConnected() override;
    virtual bool disConnect() override;

    // BaseResponder interface
public:
    virtual void response(QByteArray data) override;

public:
    virtual QWidget *getConfigWidget() override;

signals:

public slots:

private:
    void *_context;
    void *_socket;
    bool _isRunning;
    QWaitCondition  *_waitCondition=nullptr;
    QMutex* _mutex=nullptr;
    QByteArray _sendArr;
};

#endif // ZMQRESPONDER_H
